//package com.huang.Controller;
//
//
//import com.huang.Pojo.Order;
//import com.huang.Pojo.Product;
//import com.huang.Service.FeignClientService;
//import com.huang.Service.OrderService;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cloud.openfeign.FeignClient;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import org.springframework.web.client.RestTemplate;
//
//import javax.annotation.Resource;
//
////@RestController
//public class OrderController {
//
////    public static final String Product_Url="http://service-product";
//
//    @Resource
//    private OrderService orderService;
//
//    @Resource
//    private RestTemplate restTemplate;
//
//    @Resource
//    private FeignClientService feignClientService;
//
//    @GetMapping(value = "/order/prod/{pid}")
//    public Order order(@PathVariable("pid") Integer pid){
//
////        RestTemplete——调用商品微服务
////        Product product = restTemplate.getForObject(Product_Url+"/product/"+pid, Product.class);
////        FeignClient——调用商品微服务
//        Product product = feignClientService.product(pid);
////        下单（创建订单）
//        Order order = new Order();
//        order.setUid(2);
//        order.setUsername("测试用户02");
//        order.setPid(pid);
//        order.setPname(product.getPname());
//        order.setPprice(product.getPprice());
//        order.setNumber(2);
//
//        orderService.createOrder(order);
//
//        return order;
//    }
//}
